﻿#!/usr/bin/env python3

import shelve

class Car:
    def __init__(self, logo, category):
        self.logo = logo
        self.category = category
    def show(self):
        print("logo:{0}, category:{1}".format(self.logo, self.category))

def main():
    '''shelve -  object persistence'''
    print(main.__doc__)
    print("="*30)

    d = shelve.open("shelve.txt")
    d['logo']='Greate Wall'
    d['category']="SUV"
    d.close()

    d = shelve.open("shelve.txt")
    for key,value in d.items():
        print("{0:>10}:{1}".format(key,value))
    d.close()

if __name__=='__main__':
    main()
